﻿using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace 温湿度和颗粒度监控测试.Common
{
    public class NotifyBase: INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        protected void DoNotify([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }

        protected void SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = "")
        {
            storage = value;
            DoNotify(propertyName);
        }
    }
}
